package com.zmn.oms.persistence.interfaces.discount;

import com.zmn.oms.model.entity.discount.OrderDiscount;
import com.zmn.oms.model.entity.discount.OrderDiscountQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 类描述：订单优惠 dao
 *
 * @author lujia
 * @date 2018-11-28 14:25:25
 */
public interface OrderDiscountDao {

    /**
     * 根据订单Id集合查询订单优惠信息
     *
     * @param orderIdList 订单id集合
     * @return 订单优惠
     */
    List<OrderDiscount> listOrderDiscountByOrderIdList(@Param("orderIdList") List<Long> orderIdList);

    List<OrderDiscount> listByQuery(OrderDiscountQuery query);

    /**
     * 通过工单获取优惠列表
     *
     * @param orderId
     * @return
     */
    List<OrderDiscount> listByOrderId(Long orderId);

    OrderDiscount selectByPrimaryKey(Long discountId);

    int insert(OrderDiscount orderDiscount);

    int updateByPrimaryKeySelective(OrderDiscount record);

    int updateSellAmount(OrderDiscount record);

    int deleteByPrimaryKey(Long discountId);

    int deleteByOrderIdAndCateg(OrderDiscount orderDiscount);

    /**
     * 通过订单Id删除优惠
     * @param orderId
     * @return
     */
    Integer deleteByOrderId(Long orderId);

    /**
     * 根据订单Id删除
     * @param orderId
     * @param artificial
     * @return
     */
    Integer deleteByArtificialDiscount(@Param("orderId") Long orderId, @Param("artificial") List<Integer> artificial);

    /**
     * 保存优惠列表
     * @param orderDiscountList
     */
    void insertOrderDiscountList(@Param("discountList") List<OrderDiscount> orderDiscountList);

    /**
     * 批量更新
     * @param orderDiscountList
     */
    void updateBatch(@Param("discountList") List<OrderDiscount> orderDiscountList);
}